package com.tbit.uqbike.webmanager.dao.core;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tbit.uqbike.object.pojo.UpgradeDetail;
import com.tbit.uqbike.object.pojo.UpgradeMachine;
import com.tbit.uqbike.object.pojo.dto.UpgradeDTO;
import com.tbit.uqbike.object.pojo.vo.UpgradeDetailVO;
import com.tbit.uqbike.object.pojo.vo.UpgradeVO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author <a href="mailto:liu.haoxiang@tbit.com.cn">BUGXiang</a>
 * @version 1.0
 * @since 2024/3/15
 */
public interface UpgradeDao extends BaseMapper<UpgradeMachine> {

    /**
     * 分页查询
     *
     * @param upgradeDTO upgradeDTO
     * @return List<UpgradeVO>
     */
    List<UpgradeVO> queryPage(UpgradeDTO upgradeDTO);

    /**
     * 获取车辆id
     *
     * @param accountId 区域id
     * @return result
     */
    List<String> selectMachineId(Integer accountId);

    /**
     * 获取升级设备信息
     *
     * @param accountId accountId
     * @return UpgradeMachine
     */
    List<UpgradeVO> selectMachineByAccountId(Integer accountId);

    /**
     * 获取设备编号和版本号
     *
     * @param upgradeId 升级车辆id
     * @return list
     */
    UpgradeDetailVO selectByUogradeId(Integer upgradeId);

    /**
     * 修改单个设备的状态
     * @param machineNo 设备编号
     * @param status 5-升级中
     */
    void updateStatus(@Param("machineNo") String machineNo, @Param("status") int status);

    /**
     * 批量修改设备状态
     * @param machines machines
     */
    void batchUpdate(@Param("machines") List<UpgradeDetail> machines);
}
